<template>
  <keep-alive>
    <component
    :is="currentComponent"
    @current="current"
    ></component>
  </keep-alive>
</template>

<script>
import TreatmentIncrease from "./treatmentIncrease.vue";
import TreatmentDetail from "./treatmentDetail.vue";
import { mapState } from "vuex";

export default {
  components: {
    TreatmentIncrease,
    TreatmentDetail
  },
  data() {
    return {
      currentComponent: TreatmentIncrease
      // currentComponent: TreatmentDetail
    }
  },
  computed: {
    ...mapState({
      operationPage: state=>state.user.operationPage,
    })
  },
  mounted() {
    console.log("111------",this.operationPage);
  },
  methods: {
    current(val){
      console.log(val);
      console.log("111-=========",this.operationPage);
      switch (val) {
        case 1:
          this.currentComponent = TreatmentIncrease;
          break;
        case 2:
          this.currentComponent = TreatmentDetail
          break;
        default:
          this.currentComponent = TreatmentIncrease;
          break;
      }
    }
  }
}
</script>

<style>

</style>